﻿function addOneSpec() {
    var _0x7035x2 = $('#spec_id_one')['val']();
    var _0x7035x3 = $('#0_spec_one')['val']();
    var _0x7035x4 = $('#0_spec_img_one')['val']();
    console['log'](_0x7035x3);
    if ($['trim'](_0x7035x3) == '') {
        layer['msg']('请输入规格', {
            icon: 5,
            time: 1200
        });
        return false
    };
    if (_0x7035x4 == '') {
        layer['msg']('请上传规格图片', {
            icon: 5,
            time: 1200
        });
        return false
    };
    ajax('/goods/AddSpecValue/', {
        id: _id,
        sId: _0x7035x2,
        name: _0x7035x3,
        img: _0x7035x4
    }, function (_0x7035x5) {
        if (_0x7035x5['status'] == 'y') {
            var _0x7035x6 = $('#0_one');
            var _0x7035x7 = '<li id="' + spec_ul_one_li + '_one"><div> <input id="' + spec_ul_one_li + '_value_id_one" type="hidden" value="' + _0x7035x5['sId'] + '" />' + '<img src="/Content/img/icon_close_alt.png" class="delete" onclick="delSpeVal(1,' + spec_ul_one_li + ',this)" />' + '<input id="' + spec_ul_one_li + '_spec_one" type="text" class="form-control" value="' + $('#0_spec_one')['val']() + '" readonly="readonly" />';
            _0x7035x7 += '<input id="' + spec_ul_one_li + '_spec_img_one" value="' + $('#0_spec_img_one')['val']() + '" type="hidden" />' + '<div class="layui-upload">' + '<div class="layui-upload-list">' + '<img class="layui-upload-img" src="' + $('#0_uploadPrevie_one')['attr']('src') + '" id="' + spec_ul_one_li + '_uploadPrevie_one">' + '<p id="' + spec_ul_one_li + '_text_tip_one"></p>' + '</div>' + '</div>';
            _0x7035x7 += '</div></li>';
            _0x7035x6['before'](_0x7035x7);
            spec_ul_one_li++;
            $('#0_value_id_one')['val']('0');
            $('#0_spec_one')['val']('');
            $('#0_spec_img_one')['val']('');
            $('#0_uploadPrevie_one')['removeAttr']('src')
        } else {
            layer['msg'](_0x7035x5['info'], {
                icon: 5,
                time: 1200
            })
        }
    })
}
function addTwoSpec() {
    var _0x7035x2 = $('#spec_id_two')['val']();
    var _0x7035x3 = $('#0_spec_two')['val']();
    if ($['trim'](_0x7035x3) == '') {
        layer['msg']('请输入规格', {
            icon: 5,
            time: 1200
        });
        return false
    };
    ajax('/goods/AddSpecValue/', {
        id: _id,
        sId: _0x7035x2,
        name: _0x7035x3,
        img: ''
    }, function (_0x7035x5) {
        if (_0x7035x5['status'] == 'y') {
            var _0x7035x6 = $('#0_two');
            var _0x7035x9 = '<li id="' + spec_ul_two_li + '_two"><div> <input id="' + spec_ul_two_li + '_value_id_two" type="hidden" value="' + _0x7035x5['sId'] + '"/>' + '<img src="/Content/img/icon_close_alt.png" class="delete" onclick="delSpeVal(2,' + spec_ul_two_li + ',this)" />' + '<input id="' + spec_ul_two_li + '_spec_two" type="text" class="form-control" value="' + $('#0_spec_two')['val']() + '" readonly="readonly" />';
            _0x7035x9 += '</div></li>';
            spec_ul_two_li++;
            _0x7035x6['before'](_0x7035x9);
            $('#0_value_id_two')['val']('0');
            $('#0_spec_two')['val']('')
        } else {
            layer['msg'](_0x7035x5['info'], {
                icon: 5,
                time: 1200
            })
        }
    })
}
function addSpec() {
    if (spec_num >= 2) {
        layer['msg']('您已添加2个规格类型', {
            time: 1200
        });
        return false
    };
    var _0x7035x2 = $('#goods_spec')['val']();
    var _0x7035xb = '规格类型：' + $('#goods_spec option:selected')['text']();
    var _0x7035xc = $['trim']($('#my_spec')['val']());
    if (_0x7035x2 == '-1') {
        layer['msg']('请选择规格', {
            time: 1200
        });
        return false
    } else {
        if (_0x7035x2 == '0' && _0x7035xc == '') {
            layer['msg']('请输入规格', {
                time: 1200
            });
            return false
        } else {
            if (_0x7035x2 == '0') {
                ajax('/goods/AddMySpec/', {
                    goodsId: _id,
                    name: _0x7035xc,
                    description: ''
                }, function (_0x7035x5) {
                    if (_0x7035x5['status'] == 'y') {
                        _0x7035x2 = _0x7035x5['sId'];
                        addSpecItem(_0x7035x2, _0x7035xb)
                    } else {
                        layer['msg'](_0x7035x5['info'], {
                            icon: 5,
                            time: 1200
                        })
                    }
                });
                $('#my_spec')['val']('')['hide']()
            } else {
                addSpecItem(_0x7035x2, _0x7035xb)
            }
        }
    }
}
function addSpecItem(_0x7035x2, _0x7035xb) {
    if (!group_one) {
        $('#lab_one')['text'](_0x7035xb);
        $('#spec_id_one')['val'](_0x7035x2);
        var _0x7035xe = $('#my_spec_one');
        var _0x7035x9 = '<li id="' + spec_ul_one_li + '_one"><div><input id="' + spec_ul_one_li + '_value_id_one" type="hidden" value="0" />' + '<input id="' + spec_ul_one_li + '_spec_one" type="text" class="form-control" placeholder="\u89C4\u683C" />';
        _0x7035x9 += '<input id="' + spec_ul_one_li + '_spec_img_one" type="hidden" />' + '<div class="layui-upload">' + '<div class="layui-upload-list">' + '<img class="layui-upload-img" id="' + spec_ul_one_li + '_uploadPrevie_one">' + '<p id="' + spec_ul_one_li + '_text_tip_one"></p>' + '</div>' + '<button type="button" class="layui-btn" id="' + spec_ul_one_li + '_uploadBut_one">\u4E0A\u4F20\u56FE\u7247</button><input class="layui-upload-file" type="file" accept="undefined" name="file">' + '</div>';
        upload(spec_ul_one_li, '#' + spec_ul_one_li + '_uploadBut_one', '#' + spec_ul_one_li + '_uploadPrevie_one', '#' + spec_ul_one_li + '_spec_img_one', '#' + spec_ul_one_li + '_text_tip_one');
        _0x7035x9 += '</div></li>';
        _0x7035xe['append'](_0x7035x9);
        $('#form-group-one')['show']();
        group_one = true;
        spec_ul_one_li++;
        spec_num++;
        $('#add_spec_one')['show']();
        $('#del_spec_one')['show']();
        $('#btnMake')['show']()
    } else {
        if (spec_num == 1 && !group_two) {
            var _0x7035xf = $['trim']($('#lab_one')['text']());
            $('#spec_id_two')['val'](_0x7035x2);
            if (_0x7035xb == _0x7035xf) {
                layer['msg']('该规格已添加', {
                    time: 1200
                });
                return false
            };
            $('#lab_two')['text'](_0x7035xb);
            var _0x7035xe = $('#my_spec_two');
            var _0x7035x9 = '<li id="' + spec_ul_two_li + '_two"><div> <input id="' + spec_ul_two_li + '_value_id_one" type="hidden" value="0" />' + '<img src="/Content/img/icon_close_alt.png" class="delete" onclick="delSpeVal(2,' + spec_ul_two_li + ',this)" />' + '<input id="' + spec_ul_two_li + '_spec_two" type="text" class="form-control" placeholder="\u89C4\u683C" />';
            _0x7035x9 += '</div></li>';
            _0x7035xe['append'](_0x7035x9);
            $('#form-group-two')['show']();
            group_two = true;
            spec_ul_two_li++;
            spec_num++;
            $('#add_spec_two')['show']();
            $('#del_spec_two')['show']()
        }
    }
}
function delSpe(_0x7035x11) {
    layer['confirm']('确定要删除吗？', {
        icon: 3,
        title: '提示'
    }, function (_0x7035x12) {
        var _0x7035x13 = 0;
        if (_0x7035x11 == 1) {
            _0x7035x13 = $('#spec_id_one')['val']()
        } else {
            if (_0x7035x11 == 2) {
                _0x7035x13 = $('#spec_id_two')['val']()
            }
        };
        ajax('/goods/DeleteGoodsSpec', {
            goodsId: _id,
            specId: _0x7035x13
        }, function (_0x7035x5) {
            if (_0x7035x5['status'] == 'y') {
                if (_0x7035x11 == 1) {
                    $('#lab_one')['text']('');
                    $('#spec_id_one')['val']('0');
                    $('#my_spec_one')['html']('');
                    $('#form-group-one')['hide']();
                    spec_num--;
                    group_one = false
                } else {
                    if (_0x7035x11 == 2) {
                        $('#lab_two')['text']('');
                        $('#spec_id_two')['val']('0');
                        $('#my_spec_two')['html']('');
                        $('#form-group-two')['hide']();
                        spec_num--;
                        group_two = false
                    }
                };
                layer['msg']('操作成功', {
                    icon: 6,
                    time: 1200
                }, function () {
                    window['location']['href'] = location
                })
            } else {
                layer['msg'](_0x7035x5['info'], {
                    icon: 5,
                    time: 1200
                })
            }
        });
        layer['close']()
    })
}
function delSpeVal(_0x7035x11, _0x7035x12, _0x7035x15) {
    layer['confirm']('确定要删除吗？', {
        icon: 3,
        title: '提示'
    }, function () {
        var _0x7035x13;
        if (_0x7035x11 == 1) {
            _0x7035x13 = $('#' + _0x7035x12 + '_value_id_one')['val']()
        } else {
            if (_0x7035x11 == 2) {
                _0x7035x13 = $('#' + _0x7035x12 + '_value_id_two')['val']()
            }
        };
        console['log'](_0x7035x13);
        if (!_0x7035x13 || _0x7035x13 == '0') {
            layer['msg']('操作成功', {
                icon: 6,
                time: 1000
            }, function () {
                if (_0x7035x11 == 1) {
                    spec_ul_one_li--
                } else {
                    if (_0x7035x11 == 2) {
                        spec_ul_two_li--
                    }
                };
                $(_0x7035x15)['parent']()['parent']()['remove']()
            });
            return false
        };
        ajax('/goods/DeleteGoodsSpecValue', {
            id: _0x7035x13,
            tid: _id
        }, function (_0x7035x5) {
            if (_0x7035x5['status'] == 'y') {
                layer['msg']('操作成功', {
                    icon: 6,
                    time: 1200
                }, function () {
                    if (_0x7035x11 == 1) {
                        spec_ul_one_li--
                    } else {
                        if (_0x7035x11 == 2) {
                            spec_ul_two_li--
                        }
                    };
                    $(_0x7035x15)['parent']()['parent']()['remove']()
                })
            } else {
                layer['msg'](_0x7035x5['info'], {
                    icon: 5,
                    time: 1200
                })
            }
        })
    })
}
function get_spec_list(_0x7035x17) {
    ajax('/goods/GetSpecList', {}, function (_0x7035x5) {
        var _0x7035x18 = '<option value=\'-1\'>-请选择-</option>';
        _0x7035x18 += '<option value=\'0\'>-其他-</option>';
        $['each'](_0x7035x5, function (_0x7035x19, _0x7035x1a) {
            _0x7035x18 += '<option value=\'' + _0x7035x1a['id'] + '\'>' + _0x7035x1a['name'] + '</option>'
        });
        $('#goods_spec')['html'](_0x7035x18)
    })
}
function upload(_0x7035x1c, _0x7035x1d, _0x7035x1e, _0x7035x1f, _0x7035x20) {
    layui['use']('upload', function () {
        var _0x7035x21 = layui['jquery'],
            upload = layui['upload'];
        var _0x7035x22 = upload['render']({
                elem: _0x7035x1d,
                url: domain + '/tools/UploadSpecImg?type=GoodsSpec',
                size: 1024,
                before: function (_0x7035x15) {
                    _0x7035x15['preview'](function (_0x7035x12, _0x7035x23, _0x7035x24) {
                        _0x7035x21(_0x7035x1e)['attr']('src', _0x7035x24)
                    })
                },
                done: function (_0x7035x25) {
                    _0x7035x21(_0x7035x1e)['attr']('src', domain + _0x7035x25['info']);
                    _0x7035x21(_0x7035x1f)['val'](sqlImgdomain + _0x7035x25['info'])
                },
                error: function () {
                    var _0x7035x26 = _0x7035x21(_0x7035x20);
                    _0x7035x26['html']('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重\u8BD5</a>');
                    _0x7035x26['find']('.demo-reload')['on']('click', function () {
                        _0x7035x22['upload']()
                    })
                }
            })
    })
}
function makeSku() {
    layer['confirm']('确定规格已设定？', {
        icon: 3,
        title: '提示'
    }, function (_0x7035x12) {
        var _0x7035x28 = $('#spec_id_one')['val']();
        var _0x7035x29 = $('#spec_id_two')['val']();
        if (_0x7035x28 != '0') {
            var _0x7035x2a = $('#0_spec_one')['val']();
            var _0x7035x2b = $('#0_spec_img_one')['val']();
            if (_0x7035x2a != '' && _0x7035x2b != '') {
                ajax('/goods/AddSpecValue/', {
                    id: _id,
                    sId: _0x7035x28,
                    name: _0x7035x2a,
                    img: _0x7035x2b
                }, function (_0x7035x5) {
                    if (_0x7035x29 != '0') {
                        var _0x7035x2c = $('#0_spec_two')['val']();
                        if (_0x7035x2c != '') {
                            ajax('/goods/AddSpecValue/', {
                                id: _id,
                                sId: _0x7035x29,
                                name: _0x7035x2c,
                                img: ''
                            }, function (_0x7035x5) {
                                MakeSkuAjax()
                            })
                        } else {
                            MakeSkuAjax()
                        }
                    } else {
                        MakeSkuAjax()
                    }
                })
            } else {
                if (_0x7035x29 != '0') {
                    var _0x7035x2c = $('#0_spec_two')['val']();
                    if (_0x7035x2c != '') {
                        ajax('/goods/AddSpecValue/', {
                            id: _id,
                            sId: _0x7035x29,
                            name: _0x7035x2c,
                            img: ''
                        }, function (_0x7035x5) {
                            MakeSkuAjax()
                        })
                    } else {
                        MakeSkuAjax()
                    }
                } else {
                    MakeSkuAjax()
                }
            }
        } else {
            if (_0x7035x29 != '0') {
                var _0x7035x2c = $('#0_spec_two')['val']();
                if (_0x7035x2c != '') {
                    ajax('/goods/AddSpecValue/', {
                        id: _id,
                        sId: _0x7035x29,
                        name: _0x7035x2c,
                        img: ''
                    }, function (_0x7035x5) {
                        MakeSkuAjax()
                    })
                } else {
                    MakeSkuAjax()
                }
            } else {
                MakeSkuAjax()
            }
        }
    })
}
function MakeSkuAjax() {
    ajax('/goods/MakeSku', {
        id: _id
    }, function (_0x7035x5) {
        if (_0x7035x5['status'] == 'y') {
            layer['msg'](_0x7035x5['info'], {
                time: 1200
            }, function () {
                window['location']['href'] = '/goods/GoodsSku/' + _id
            })
        } else {
            layer['msg'](_0x7035x5['info'], {
                time: 1200
            })
        }
    })
}
function initSpec(_0x7035x17) {
    ajax('/goods/GetSpecWithValue/' + _0x7035x17, {}, function (_0x7035x5) {
        if (_0x7035x5 != null) {
            if (_0x7035x5['img_spec'] != null) {
                $('#lab_one')['text']('规格类型：' + _0x7035x5['img_spec']['name']);
                $('#spec_id_one')['val'](_0x7035x5['img_spec']['id']);
                var _0x7035xe = $('#my_spec_one');
                var _0x7035x2f = '<li id="' + spec_ul_one_li + '_one"><div><input id="' + spec_ul_one_li + '_value_id_one" type="hidden" value="0" />' + '<input id="' + spec_ul_one_li + '_spec_one" type="text" class="form-control" placeholder="\u89C4\u683C" />';
                _0x7035x2f += '<input id="' + spec_ul_one_li + '_spec_img_one" type="hidden" />' + '<div class="layui-upload">' + '<div class="layui-upload-list">' + '<img class="layui-upload-img" id="' + spec_ul_one_li + '_uploadPrevie_one">' + '<p id="' + spec_ul_one_li + '_text_tip_one"></p>' + '</div>' + '<button type="button" class="layui-btn" id="' + spec_ul_one_li + '_uploadBut_one">\u4E0A\u4F20\u56FE\u7247</button><input class="layui-upload-file" type="file" accept="undefined" name="file">' + '</div>';
                _0x7035x2f += '</div></li>';
                upload(0, '#0_uploadBut_one', '#0_uploadPrevie_one', '#0_spec_img_one', '#0_text_tip_one');
                spec_ul_one_li++;
                if (_0x7035x5['img_spec']['value_list'] != null && _0x7035x5['img_spec']['value_list']['length'] > 0) {
                    $['each'](_0x7035x5['img_spec']['value_list'], function (_0x7035x30, _0x7035x1a) {
                        var _0x7035x31 = '<li id="' + spec_ul_one_li + '_one"><div><input id="' + spec_ul_one_li + '_value_id_one" type="hidden" value="' + _0x7035x1a['id'] + '" />' + '<img src="/Content/img/icon_close_alt.png" class="delete" onclick="delSpeVal(1,' + spec_ul_one_li + ',this)" />' + '<input id="' + spec_ul_one_li + '_spec_one" type="text" value="' + (_0x7035x1a['name'] == '' ? '默认' : _0x7035x1a['name']) + '" readonly="readonly" class="form-control" placeholder="\u89C4\u683C" />';
                        _0x7035x31 += '<input id="' + spec_ul_one_li + '_spec_img_one" value="' + _0x7035x1a['thumb_url'] + '" type="hidden" />' + '<div class="layui-upload">' + '<div class="layui-upload-list">' + '<img class="layui-upload-img" id="' + spec_ul_one_li + '_uploadPrevie_one" src="' + domain + _0x7035x1a['thumb_url'] + '">' + '<p id="' + spec_ul_one_li + '_text_tip_one"></p>' + '</div>' + '</div>';
                        _0x7035x31 += '</div></li>';
                        _0x7035xe['append'](_0x7035x31);
                        spec_ul_one_li++
                    })
                };
                _0x7035xe['append'](_0x7035x2f);
                $('#form-group-one')['show']();
                group_one = true;
                spec_num++;
                $('#add_spec_one')['show']();
                $('#del_spec_one')['show']();
                $('#btnMake')['show']()
            };
            if (_0x7035x5['text_spec'] != null) {
                $('#lab_two')['text']('规格类型：' + _0x7035x5['text_spec']['name']);
                $('#spec_id_two')['val'](_0x7035x5['text_spec']['id']);
                var _0x7035xe = $('#my_spec_two');
                var _0x7035x2f = '<li id="' + spec_ul_two_li + '_two"><div><input id="' + spec_ul_two_li + '_value_id_two" type="hidden" value="0" />' + '<img src="/Content/img/icon_close_alt.png" class="delete" onclick="delSpeVal(1,' + spec_ul_two_li + ',this)" />' + '<input id="' + spec_ul_two_li + '_spec_two" type="text" class="form-control" placeholder="\u89C4\u683C" />';
                _0x7035x2f += '</div></li>';
                spec_ul_two_li++;
                if (_0x7035x5['text_spec']['value_list'] != null && _0x7035x5['text_spec']['value_list']['length'] > 0) {
                    $['each'](_0x7035x5['text_spec']['value_list'], function (_0x7035x30, _0x7035x1a) {
                        var _0x7035x31 = '<li id="' + spec_ul_two_li + '_two"><div><input id="' + spec_ul_two_li + '_value_id_two" type="hidden" value="' + _0x7035x1a['id'] + '" />' + '<img src="/Content/img/icon_close_alt.png" class="delete" onclick="delSpeVal(2,' + spec_ul_two_li + ',this)" />' + '<input id="' + spec_ul_two_li + '_spec_two" type="text" value="' + (_0x7035x1a['name'] == '' ? '默认' : _0x7035x1a['name']) + '" readonly="readonly" class="form-control" placeholder="\u89C4\u683C" />';
                        _0x7035x31 += '</div></li>';
                        _0x7035xe['append'](_0x7035x31);
                        spec_ul_two_li++
                    })
                };
                _0x7035xe['append'](_0x7035x2f);
                $('#form-group-two')['show']();
                group_two = true;
                spec_num++;
                $('#add_spec_two')['show']();
                $('#del_spec_two')['show']();
                $('#btnMake')['show']()
            }
        }
    })
}
function PublishGoods() {
    var _0x7035x33 = $('#tablesku_list :text')['length'];
    var _0x7035x34 = $('#tablesku_list :text[readonly]')['length'];
    if (_0x7035x33 != _0x7035x34) {
        layer['msg']('请先保存更改！', {
            time: 1200
        });
        return false
    };
    ajax('/goods/SetGoodsIsUse/', {
        id: _id,
        isUse: 1
    }, function (_0x7035x5) {
        if (_0x7035x5['status'] == 'y') {
            layer['msg']('操作成功', {
                icon: 6,
                time: 1200
            }, function () {
                window['location']['href'] = '/goods/index/' + _tid
            })
        } else {
            layer['msg'](_0x7035x5['info'], {
                icon: 5,
                time: 2000
            })
        }
    })
}
function getgoodsku(_0x7035x17) {
    var _0x7035x36 = $('#tablesku_title');
    var _0x7035x37 = $('#tablesku_list');
    _0x7035x37['html']('');
    if (_skuNum > 0) {
        var _0x7035x38 = '';
        ajax('/goods/GetSpecSkuList/' + _0x7035x17, {}, function (_0x7035x5) {
            if (_0x7035x5 != null) {
                if (_0x7035x5['goods_spec']['length'] == 1 && _0x7035x5['goods_sku']['length'] > 0) {
                    _0x7035x36['html']('<tr><th>' + _0x7035x5['goods_spec'][0]['name'] + '</th><th>平台价</th>' + _0x7035x38 + '<th>结算价</th><th>市场价</th><th>剩余库存</th><th>平台总库存</th><th>操作</th></tr>');
                    $['each'](_0x7035x5['goods_sku'], function (_0x7035x1c, _0x7035x1a) {
                        var _0x7035x9 = '<tr><td class="i_bolder">' + (_0x7035x1a['specs'] == '' ? '默认' : _0x7035x1a['specs']) + '</td>' + '<td><input type="text" id="' + _0x7035x1c + '_sale_price" class="form-control" readonly="readonly" value="' + _0x7035x1a['sale_price'] + '" /></td>';
                        _0x7035x9 += '<td><input type="text" id="' + _0x7035x1c + '_settlement_price" class="form-control" readonly="readonly" value="' + _0x7035x1a['settlement_price'] + '" /></td>';
                        _0x7035x9 += '<td><input type="text" id="' + _0x7035x1c + '_market_price" class="form-control" readonly="readonly" value="' + _0x7035x1a['market_price'] + '" /></td>' + '<td><input type="text" id="' + _0x7035x1c + '_stock" class="form-control" readonly="readonly" value="' + _0x7035x1a['stock_quantity'] + '" /></td>' + '<td id="' + _0x7035x1c + '_all_stock">&nbsp;&nbsp;' + _0x7035x1a['all_stock'] + '</td>' + '<td><a title="' + _0x7035x1a['id'] + '" href="javascript:;" onclick="editSku(' + _0x7035x1a['id'] + ',' + _0x7035x1c + ',this)" >编辑</a>' + '</td>' + '</tr>';
                        _0x7035x37['append'](_0x7035x9)
                    })
                } else {
                    if (_0x7035x5['goods_spec']['length'] == 2) {
                        _0x7035x36['html']('<tr><th>' + _0x7035x5['goods_spec'][0]['name'] + '</th><th >' + _0x7035x5['goods_spec'][1]['name'] + '</th><th>平台价</th>' + _0x7035x38 + '<th>结算价</th><th>市场价</th><th>剩余库存</th><th>平台总库存</th><th>操作</th></tr>');
                        var _0x7035x39 = '';
                        var _0x7035x3a = 0;
                        var _0x7035x3b = 0;
                        $['each'](_0x7035x5['goods_specvalue'], function (_0x7035x1c, _0x7035x1a) {
                            _0x7035x3a += (_0x7035x1a['sku_count']);
                            _0x7035x39 += '<tr><td class="i_bolder">' + _0x7035x1a['name'] + '</td>';
                            _0x7035x39 += '<td><table class="table ">';
                            $['each'](_0x7035x1a['sku'], function (_0x7035x3c, _0x7035x3d) {
                                var _0x7035x3e = $['parseJSON'](_0x7035x3d['specs']);
                                var _0x7035x3f = '';
                                $['each'](_0x7035x3e, function (_0x7035x3c, _0x7035x40) {
                                    if (_0x7035x40['spec_value'] != _0x7035x1a['name']) {
                                        _0x7035x3f = _0x7035x40['spec_value']
                                    }
                                });
                                _0x7035x39 += '<tr><td>' + _0x7035x3f + '</td></tr>'
                            });
                            _0x7035x39 += '</table></td>';
                            var _0x7035x41 = _0x7035x1c * _0x7035x1a['sku_count'];
                            _0x7035x39 += '<td><table class="table ">';
                            $['each'](_0x7035x1a['sku'], function (_0x7035x3c, _0x7035x3d) {
                                _0x7035x39 += '<tr><td><input type="text" id="' + (_0x7035x41 + _0x7035x3c) + '_sale_price" class="form-control" readonly="readonly" value="' + _0x7035x3d['sale_price'] + '" /></td></tr>'
                            });
                            _0x7035x39 += '</table></td>';
                            _0x7035x39 += '<td><table class="table ">';
                            $['each'](_0x7035x1a['sku'], function (_0x7035x3c, _0x7035x3d) {
                                _0x7035x39 += '<tr><td><input type="text" id="' + (_0x7035x41 + _0x7035x3c) + '_settlement_price" class="form-control" readonly="readonly" value="' + _0x7035x3d['settlement_price'] + '" /></td></tr>'
                            });
                            _0x7035x39 += '</table></td>';
                            _0x7035x39 += '<td><table class="table ">';
                            $['each'](_0x7035x1a['sku'], function (_0x7035x3c, _0x7035x3d) {
                                _0x7035x39 += '<tr><td><input type="text" id="' + (_0x7035x41 + _0x7035x3c) + '_market_price" class="form-control" readonly="readonly" value="' + _0x7035x3d['market_price'] + '" /></td></tr>'
                            });
                            _0x7035x39 += '</table></td>';
                            _0x7035x39 += '<td><table class="table ">';
                            $['each'](_0x7035x1a['sku'], function (_0x7035x3c, _0x7035x3d) {
                                _0x7035x39 += '<tr><td><input type="text" id="' + (_0x7035x41 + _0x7035x3c) + '_stock" class="form-control" readonly="readonly" value="' + _0x7035x3d['stock_quantity'] + '" /></td></tr>'
                            });
                            _0x7035x39 += '</table></td>';
                            _0x7035x39 += '<td><table class="table ">';
                            $['each'](_0x7035x1a['sku'], function (_0x7035x3c, _0x7035x3d) {
                                _0x7035x39 += '<tr><td id="' + (_0x7035x41 + _0x7035x3c) + '_all_stock"> &nbsp;&nbsp;' + _0x7035x3d['all_stock'] + '</td ></tr>'
                            });
                            _0x7035x39 += '</table></td>';
                            _0x7035x39 += '<td><table class="table ">';
                            $['each'](_0x7035x1a['sku'], function (_0x7035x3c, _0x7035x3d) {
                                _0x7035x39 += '<tr><td ><a title="' + _0x7035x3d['id'] + '" href="javascript:;" onclick=" editSku(' + _0x7035x3d['id'] + ',' + (_0x7035x41 + _0x7035x3c) + ',this)" >编辑</a>' + '</td></tr>'
                            });
                            _0x7035x39 += '</table></td>';
                            _0x7035x3b += (_0x7035x1a['sku_count'])
                        });
                        _0x7035x37['append'](_0x7035x39)
                    }
                }
            } else {
                _0x7035x36['html']('<tr><td style=\'text-align: center; \'>\u6CA1\u6709\u6570\u636E</td><tr/>')
            }
        });
        $('#btn_div')['show']()
    } else {
        _0x7035x36['html']('<tr><td style=\'text-align: center; \'>\u6CA1\u6709\u6570\u636E</td><tr/>')
    }
}
function goods_sku(_0x7035x17, _0x7035x43, _0x7035x44, _0x7035x45, _0x7035x46, _0x7035x3e, _0x7035x47) {
    this['id'] = _0x7035x17;
    this['sale_price'] = _0x7035x43;
    this['all_stock'] = _0x7035x44;
    this['stock_quantity'] = _0x7035x45;
    this['is_sale'] = _0x7035x46;
    this['specs'] = _0x7035x3e;
    this['thumb_url'] = _0x7035x47
}
function goods_spec(_0x7035x49, _0x7035x4a, _0x7035x4b, _0x7035x4c, _0x7035x3d) {
    this['name'] = _0x7035x49;
    this['goods_specvalue'] = goods_specvalue(_0x7035x4a, _0x7035x4b, _0x7035x4c, _0x7035x3d)
}
function goods_specvalue(_0x7035x49, _0x7035x17, _0x7035x4c, _0x7035x3d) {
    this['name'] = _0x7035x49;
    this['id'] = _0x7035x17;
    this['sku_count'] = _0x7035x4c;
    this['sku'] = goods_sku(_0x7035x17, sale_price, all_stock, stock_quantity, is_sale, specs, thumb_url)
}
function getgoodsku0(_0x7035x17) {
    var _0x7035x37 = $('#tablespec');
    var _0x7035x4f = '';
    ajax('/goods/GetGoodsSkuList/' + _0x7035x17, {}, function (_0x7035x5) {
        var _0x7035x50 = [];
        var _0x7035x51 = [];
        var _0x7035x52 = [];
        var _0x7035x53 = [];
        $['each'](_0x7035x5, function (_0x7035x1c, _0x7035x1a) {
            if (_0x7035x1a['specs'] != '') {
                var _0x7035x3f = $['parseJSON'](_0x7035x1a['specs']);
                var _0x7035x54 = {};
                _0x7035x54['id'] = _0x7035x1a['id'];
                _0x7035x54['spec'] = _0x7035x3f;
                _0x7035x50['push'](_0x7035x54);
                $['each'](_0x7035x3f, function (_0x7035x3c, _0x7035x40) {
                    _0x7035x4f += _0x7035x40['spec_key'] + ' ' + _0x7035x40['spec_value'] + ' ';
                    _0x7035x52['push'](_0x7035x40);
                    if (_0x7035x51['indexOf'](_0x7035x40['spec_key']) == -1) {
                        _0x7035x51['push'](_0x7035x40['spec_key'])
                    }
                })
            };
            $['each'](_0x7035x50, function (_0x7035x55, _0x7035x3d) {
                $['each'](_0x7035x3d, function (_0x7035x56, _0x7035x3e) {})
            });
            _0x7035x37['append']('<tr>' + '<td>' + _0x7035x5[_0x7035x1c]['id'] + '</td>' + '<td>' + _0x7035x4f + '</td>' + '<td> ' + (_0x7035x5[_0x7035x1c]['thumb_url'] == null ? '' : ('<img src=\'' + domain + _0x7035x5[_0x7035x1c]['thumb_url'] + '\' width=\'64px\' height=\'64px\'/>')) + '</td>' + '<td>' + _0x7035x5[_0x7035x1c]['market_price'] + '</td>' + '<td>' + _0x7035x5[_0x7035x1c]['sale_price'] + '</td>' + '<td>' + _0x7035x5[_0x7035x1c]['stock_quantity'] + '</td>' + '<td>' + (_0x7035x5[_0x7035x1c]['published'] ? ('<a title="\u70B9\u51FB\u4E0B\u67B6" href="javascript:;" style="color:green" onclick="tuijiansku(' + _0x7035x5[_0x7035x1c]['id'] + ',0)">\u4E0A\u67B6</a>') : ('<a title="\u70B9\u51FB\u4E0A\u67B6" style="color:red" href="javascript:;" onclick="tuijiansku(' + _0x7035x5[_0x7035x1c]['id'] + ',1)">\u4E0B\u67B6</a>')) + '</td>' + '<td>' + '<a title="\u4FEE\u6539SKU" href=\'javascript:;\'  onclick="admin_edit(\'\u4FEE\u6539\u5546\u54C1SKU\',\'/goods/EditGoddsSku\',' + _0x7035x5[_0x7035x1c]['id'] + ',700,600)">编辑</a>' + '</td>' + '</tr>');
            _0x7035x4f = ''
        });
        for (var _0x7035x1c = 0; _0x7035x1c < _0x7035x51['length']; _0x7035x1c++) {
            var _0x7035x57 = {};
            var _0x7035x58 = [];
            var _0x7035x59 = [];
            var _0x7035x5a = 0;
            _0x7035x57['name'] = _0x7035x51[_0x7035x1c];
            for (var _0x7035x3c = 0; _0x7035x3c < _0x7035x52['length']; _0x7035x3c++) {
                var _0x7035x5b = {};
                if (_0x7035x51[_0x7035x1c] == _0x7035x52[_0x7035x3c]['spec_key']) {
                    if (_0x7035x58['indexOf'](_0x7035x52[_0x7035x3c]['spec_value']) == -1) {
                        _0x7035x58['push'](_0x7035x52[_0x7035x3c]['spec_value']);
                        _0x7035x5b['name'] = _0x7035x52[_0x7035x3c]['spec_value'];
                        _0x7035x59['push'](_0x7035x5b);
                        _0x7035x5a++
                    }
                }
            };
            _0x7035x57['values'] = _0x7035x58;
            _0x7035x57['count'] = _0x7035x5a;
            _0x7035x53['push'](_0x7035x57)
        };
        console['log'](_0x7035x50);
        console['log'](_0x7035x51);
        console['log'](_0x7035x52);
        console['log'](_0x7035x53)
    })
}
function delsku(_0x7035x17, _0x7035x12) {
    layer['confirm']('\u60A8确定要删除吗？', {
        icon: 3,
        title: '提示'
    }, function (_0x7035x12) {
        ajax('/goods/DeleteSku', {
            id: _0x7035x17
        }, function (_0x7035x5) {
            if (_0x7035x5['status'] == 'y') {
                layer['msg'](_0x7035x5['info'], {
                    time: 1200
                }, function () {
                    window['location']['href'] = location
                })
            } else {
                layer['msg'](_0x7035x5['info'], {
                    time: 2000
                })
            }
        })
    })
}
function editSku(_0x7035x17, _0x7035x12, _0x7035x15) {
    $('#' + _0x7035x12 + '_sale_price')['removeAttr']('readonly');
    $('#' + _0x7035x12 + '_settlement_price')['removeAttr']('readonly');
    $('#' + _0x7035x12 + '_market_price')['removeAttr']('readonly');
    $('#' + _0x7035x12 + '_stock')['removeAttr']('readonly');
    $(_0x7035x15)['text']('保存')['attr']('onClick', 'saveSku(' + _0x7035x17 + ',' + _0x7035x12 + ',this)')
}
function saveSku(_0x7035x17, _0x7035x12, _0x7035x15) {
    var _0x7035x5f = $('#' + _0x7035x12 + '_sale_price')['val']();
    var _0x7035x60 = $('#' + _0x7035x12 + '_settlement_price')['val']();
    var _0x7035x61 = $('#' + _0x7035x12 + '_market_price')['val']();
    var _0x7035x62 = $('#' + _0x7035x12 + '_stock')['val']();
    if (_0x7035x5f == '') {
        layer['msg']('请输入平台价', {
            time: 1200
        });
        return false
    };
    if (_tid != 1 && _0x7035x60 == '') {
        layer['msg']('请输入结算价', {
            time: 1200
        });
        return false
    };
    if (_0x7035x61 == '') {
        layer['msg']('请输入市场价', {
            time: 1200
        });
        return false
    };
    if (_0x7035x62 == '') {
        layer['msg']('请输入库存', {
            time: 1200
        });
        return false
    };
    ajax('/goods/SaveGoodsSku', {
        id: _0x7035x17,
        sale_price: _0x7035x5f,
        stock_quantity: _0x7035x62,
        settlement_price: _0x7035x60,
        market_price: _0x7035x61
    }, function (_0x7035x5) {
        if (_0x7035x5['status'] == 'y') {
            $('#' + _0x7035x12 + '_all_stock')['html']('&nbsp;&nbsp;' + _0x7035x5['all']);
            $('#' + _0x7035x12 + '_sale_price')['attr']('readonly', 'readonly');
            $('#' + _0x7035x12 + '_settlement_price')['attr']('readonly', 'readonly');
            $('#' + _0x7035x12 + '_market_price')['attr']('readonly', 'readonly');
            $('#' + _0x7035x12 + '_stock')['attr']('readonly', 'readonly');
            $(_0x7035x15)['text']('编辑')['attr']('onClick', 'editSku(' + _0x7035x17 + ',' + _0x7035x12 + ',this)')['attr']('style', 'color:#333')
        } else {
            layer['msg'](_0x7035x5['info'], {
                time: 1200
            })
        }
    })
}
function SaveMulPrice() {
    var _0x7035x5f = $('#set_all_price')['val']();
    if (_0x7035x5f == '') {
        layer['msg']('请输入价格', {
            time: 1200
        });
        return false
    };
    ajax('/goods/BulkUpdate', {
        id: _id,
        number: _0x7035x5f,
        type: 1
    }, function (_0x7035x5) {
        if (_0x7035x5['status'] == 'y') {
            $('#set_all_price')['val']('');
            getgoodsku(_id)
        } else {
            layer['msg'](_0x7035x5['info'], {
                time: 1200
            })
        }
    })
}
function SaveMulStock() {
    var _0x7035x62 = $('#set_all_stock')['val']();
    if (_0x7035x62 == '') {
        layer['msg']('请输入库存', {
            time: 1200
        });
        return false
    };
    ajax('/goods/BulkUpdate', {
        id: _id,
        number: _0x7035x62,
        type: 2
    }, function (_0x7035x5) {
        if (_0x7035x5['status'] == 'y') {
            $('#set_all_stock')['val']('');
            getgoodsku(_id)
        } else {
            layer['msg'](_0x7035x5['info'], {
                time: 1200
            })
        }
    })
}
function AddMulStock() {
    var _0x7035x62 = $('#add_all_stock')['val']();
    if (_0x7035x62 == '') {
        layer['msg']('请输入增加库存', {
            time: 1200
        });
        return false
    };
    ajax('/goods/BulkUpdate', {
        id: _id,
        number: _0x7035x62,
        type: 3
    }, function (_0x7035x5) {
        if (_0x7035x5['status'] == 'y') {
            $('#add_all_stock')['val']('');
            getgoodsku(_id)
        } else {
            layer['msg'](_0x7035x5['info'], {
                time: 1200
            })
        }
    })
}